home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / othergnu / less-1~1.zoo / linstall < prev    next >
Encoding:
Text File  |  1992-05-03  |  18.5 KB  |  861 lines

  1. # Installation script for less.
  2. # This script prompts the operator for various information
  3. # and constructs a makefile.
  4.  
  5. echo "This script will build a makefile for less."
  6. echo "If you already have a file called \"makefile\" it will be overwritten,"
  7. echo "as will the file \"defines.h\"."
  8. echo "Press RETURN to continue."
  9. read ans
  10.  
  11. echo "I will ask you some questions about your system."
  12. echo "If you do not know the answer to any question,"
  13. echo "just press RETURN and I will choose a default for you."
  14. echo "Press RETURN now."
  15. read ans
  16.  
  17. ECHO=./vecho.ttp
  18. if [ ! -f $ECHO ]
  19. then
  20.     echo "One moment..."
  21.     /bin/gcc.ttp -o $ECHO vecho.c
  22.     echo ""
  23. fi
  24.  
  25. $ECHO "Most Unix systems are derived from either System V"
  26. $ECHO "or Berkeley BSD 4.1, 4.2, 4.3, etc."
  27. $ECHO ""
  28. $ECHO "Is your system closest to:"
  29. $ECHO "  1. System V"
  30. $ECHO "  2. BSD 4.1"
  31. $ECHO "  3. BSD 4.2 or later"
  32. $ECHO "  4. Xenix"
  33. $ECHO "Enter a number, or just RETURN if you don't know: \c"
  34. read ans
  35. xenix=0
  36. case "X$ans" in
  37. X1) sys=sys5; sysname="System V" ;;
  38. X2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;;
  39. X3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;;
  40. X4) sys=sys5; xenix=1; sysname="Xenix" ;;
  41. *) sys=unknown ;;
  42. esac
  43. $ECHO ""
  44.  
  45. DATE=`/bin/date.ttp`
  46. /bin/cat.ttp >makefile <<EOF
  47. # Makefile for "less"
  48. # Generated $DATE by $0.
  49. EOF
  50.  
  51. /bin/cat.ttp >>makefile <<"EOF"
  52. #
  53. # Invoked as:
  54. #    make all
  55. #   or    make install
  56. # Plain "make" is equivalent to "make all".
  57. #
  58. # If you add or delete functions, remake funcs.h by doing:
  59. #    make newfuncs
  60. # This depends on the coding convention of function headers looking like:
  61. #    " \t public <function-type> \n <function-name> ( ... ) "
  62. #
  63. # Also provided:
  64. #    make lint    # Runs "lint" on all the sources.
  65. #    make clean    # Removes "less" and the .o files.
  66. #    make clobber    # Pretty much the same as make "clean".
  67.  
  68. SHELL = /bin/bash.ttp
  69.  
  70. EOF
  71.  
  72. /bin/cat.ttp >defines.h <<EOF
  73. /* Definition file for less */
  74. /* Generated $DATE by $0. */
  75.  
  76. EOF
  77.  
  78. /bin/cat.ttp >>defines.h <<EOF
  79. /*
  80.  * Define XENIX if running under XENIX 3.0.
  81.  */
  82. #define    XENIX        $xenix
  83.  
  84. EOF
  85. $ECHO ""
  86.  
  87.  
  88.  
  89. if [ "X$sys" = "Xunknown" ]
  90. then
  91.     alldefault=0
  92. else
  93.     def=yes
  94.     alldefault=1
  95.     $ECHO "Do you want to use ALL the defaults for $sysname?"
  96.     $ECHO "  Enter \"yes\" if you have a STANDARD $sysname."
  97.     $ECHO "  Enter \"no\" if you want to change any of the defaults. [$def] \c"
  98.     read ans
  99.     case "X$ans" in
  100.     X[yY]*) alldefault=1 ;;
  101.     X[nN]*) alldefault=0 ;;
  102.     esac
  103.     $ECHO ""
  104. fi
  105.  
  106. if [ $alldefault = 0 ]
  107. then
  108.     alloptional=0
  109. else
  110.     def=yes
  111.     alloptional=1
  112.     $ECHO "Do you want to use all the optional features of less?"
  113.     $ECHO "  Less has several features which you may or may not"
  114.     $ECHO "  wish to include, such as shell escapes."
  115.     $ECHO "  Enter \"yes\" if you want to include ALL the optional features."
  116.     $ECHO "  Enter \"no\" if you want to select individual features. [$def] \c"
  117.     read ans
  118.     case "X$ans" in
  119.     X[yY]*) alloptional=1 ;;
  120.     X[nN]*) alloptional=0 ;;
  121.     esac
  122.     $ECHO ""
  123. fi
  124.  
  125.  
  126.  
  127. def=yes
  128. x=1
  129. if [ $alldefault = 0 ]
  130. then
  131.     $ECHO "Does your C compiler support the \"void\" type? [$def] \c"
  132.     read ans
  133.     case "X$ans" in
  134.     X[yY]*) x=1 ;;
  135.     X[nN]*) x=0 ;;
  136.     esac
  137.     $ECHO ""
  138. fi
  139. /bin/cat.ttp >>defines.h <<EOF
  140. /*
  141.  * VOID is 1 if your C compiler supports the "void" type,
  142.  * 0 if it does not.
  143.  */
  144. #define    VOID        $x
  145.  
  146. EOF
  147.  
  148.  
  149.  
  150. def=yes
  151. x="void *"
  152. if [ $alldefault = 0 ]
  153. then
  154.     $ECHO "Does your C compiler support the \"void *\" type? [$def] \c"
  155.     read ans
  156.     case "X$ans" in
  157.     X[yY]*) x="void *" ;;
  158.     X[nN]*) x="char *" ;;
  159.     esac
  160.     $ECHO ""
  161. fi
  162. /bin/cat.ttp >>defines.h <<EOF
  163. /*
  164.  * VOID_POINTER is the definition of a pointer to any object.
  165.  */
  166. #define    VOID_POINTER    $x
  167.  
  168. EOF
  169.  
  170.  
  171.  
  172. def=long
  173. if [ $alldefault = 0 ]
  174. then
  175.     $ECHO "What type is the \"offset\" argument to lseek? [$def] \c"
  176.     read ans
  177.     if [ "X$ans" != "X" ]
  178.     then
  179.         def=$ans
  180.     fi
  181.     $ECHO ""
  182. fi
  183. /bin/cat.ttp >>defines.h <<EOF
  184. /*
  185.  * offset_t is the type which lseek() returns.
  186.  * It is also the type of lseek()'s second argument.
  187.  */
  188. #define    offset_t    $def
  189.  
  190. EOF
  191.  
  192.  
  193.  
  194.  
  195. def=yes; x=1
  196. if [ $alldefault = 0 ]
  197. then
  198.     $ECHO "Most Unix systems provide the stat() function."
  199.     $ECHO "Does your system have stat()? [$def] \c"
  200.     read ans
  201.     case "X$ans" in
  202.     X[yY]*) x=1 ;;
  203.     X[nN]*) x=0 ;;
  204.     esac
  205.     $ECHO ""
  206. fi
  207. /bin/cat.ttp >>defines.h <<EOF
  208. /*
  209.  * STAT is 1 if your system has the stat() call.
  210.  */
  211. #define    STAT        $x
  212.  
  213. EOF
  214.  
  215.  
  216.  
  217.  
  218. def=yes; x=1
  219. if [ $alldefault = 0 ]
  220. then
  221.     $ECHO "Most Unix systems provide the perror() function."
  222.     $ECHO "Does your system have perror()? [$def] \c"
  223.     read ans
  224.     case "X$ans" in
  225.     X[yY]*) x=1 ;;
  226.     X[nN]*) x=0 ;;
  227.     esac
  228.     $ECHO ""
  229. fi
  230. /bin/cat.ttp >>defines.h <<EOF
  231. /*
  232.  * PERROR is 1 if your system has the perror() call.
  233.  * (Actually, if it has sys_errlist, sys_nerr and errno.)
  234.  */
  235. #define    PERROR        $x
  236.  
  237. EOF
  238.  
  239.  
  240.  
  241.  
  242. def=yes; x=1
  243. if [ $alldefault = 0 ]
  244. then
  245.     $ECHO "Most Unix systems provide the time() function."
  246.     $ECHO "Does your system have time()? [$def] \c"
  247.     read ans
  248.     case "X$ans" in
  249.     X[yY]*) x=1 ;;
  250.     X[nN]*) x=0 ;;
  251.     esac
  252.     $ECHO ""
  253. fi
  254. /bin/cat.ttp >>defines.h <<EOF
  255. /*
  256.  * GET_TIME is 1 if your system has the time() call.
  257.  */
  258. #define    GET_TIME    $x
  259.  
  260. EOF
  261.  
  262. if [ $x = 0 ]
  263. then
  264.     $ECHO "What is the APPROXIMATE performance of your"
  265.     $ECHO "machine, as a percentage of a Vax 11/750?"
  266.     $ECHO "(Enter 100 if your machine is as fast as a Vax,"
  267.     $ECHO " 50 if it is half as fast, 200 if it is twice as fast, etc.)"
  268.     $ECHO "The accuracy of this information is not critical."
  269.     while :
  270.     do
  271.         $ECHO "Percent of Vax 11/750 [100]: \c"
  272.         read ans
  273.         if [ "X$ans" = "X" ]
  274.         then
  275.             ans=100
  276.         fi
  277.         longloop=`expr "$ans" "*" 3`
  278.         if [ $? = 0 ]
  279.         then
  280.             break
  281.         fi
  282.         $ECHO "Enter a number please!"
  283.     done
  284.     $ECHO ""
  285.  
  286.     /bin/cat.ttp >>defines.h <<EOF
  287. /*
  288.  * LONGLOOP is the number of lines we should process in the line number
  289.  * scan before displaying a warning that it will take a while.
  290.  */
  291. #define    LONGLOOP    ($longloop)
  292. EOF
  293. fi
  294.  
  295.  
  296.  
  297.  
  298. if [ "$sys" = "bsd" ]
  299. then
  300.     def=no; x=0
  301. else
  302.     def=yes; x=1
  303. fi
  304. if [ $alldefault = 0 ]
  305. then
  306.     $ECHO "Most System V systems have termio.h, while most"
  307.     $ECHO "Berkeley-derived systems have sgtty.h."
  308.     $ECHO "Does your system have termio.h? [$def] \c"
  309.     read ans
  310.     case "X$ans" in
  311.     X[yY]*) x=1 ;;
  312.     X[nN]*) x=0 ;;
  313.     esac
  314.     $ECHO ""
  315. fi
  316. /bin/cat.ttp >>defines.h <<EOF
  317. /*
  318.  * TERMIO is 1 if your system has /usr/include/termio.h.
  319.  * This is normally the case for System 5.
  320.  * If TERMIO is 0 your system must have /usr/include/sgtty.h.
  321.  * This is normally the case for BSD.
  322.  */
  323. #define    TERMIO        $x
  324.  
  325. EOF
  326.  
  327.  
  328.  
  329.  
  330. if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
  331. then
  332.     def=yes; x=1
  333. else
  334.     def=no; x=0
  335. fi
  336. if [ $alldefault = 0 ]
  337. then
  338.     $ECHO "Most BSD 4.2 and 4.3 systems have both _setjmp() and setjmp()."
  339.     $ECHO "Most System V and BSD 4.1 systems have only setjmp()."
  340.     $ECHO "Does your system have both _setjmp() and setjmp()? [$def] \c"
  341.     read ans
  342.     case "X$ans" in
  343.     X[yY]*) x=1 ;;
  344.     X[nN]*) x=0 ;;
  345.     esac
  346.     $ECHO ""
  347. fi
  348. /bin/cat.ttp >>defines.h <<EOF
  349. /*
  350.  * HAS__SETJMP is 1 if your system has the _setjmp() call.
  351.  * This is normally the case only for BSD 4.2 and up,
  352.  * not for BSD 4.1 or System 5.
  353.  */
  354. #define    HAS__SETJMP    $x
  355.  
  356. EOF
  357.  
  358.  
  359.  
  360.  
  361. if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
  362. then
  363.     def=yes; x=1
  364. else
  365.     def=no; x=0
  366. fi
  367. if [ $alldefault = 0 ]
  368. then
  369.     $ECHO "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
  370.     $ECHO "Most System V and BSD 4.1 systems do not."
  371.     $ECHO "Does your system have sigsetmask()? [$def] \c"
  372.     read ans
  373.     case "X$ans" in
  374.     X[yY]*) x=1 ;;
  375.     X[nN]*) x=0 ;;
  376.     esac
  377.     $ECHO ""
  378. fi
  379. /bin/cat.ttp >>defines.h <<EOF
  380. /*
  381.  * SIGSETMASK is 1 if your system has the sigsetmask() call.
  382.  * This is normally the case only for BSD 4.2,
  383.  * not for BSD 4.1 or System 5.
  384.  */
  385. #define    SIGSETMASK    $x
  386.  
  387. EOF
  388.  
  389.  
  390.  
  391.  
  392. if [ "$sys" = "sys5" -a "$xenix" = "0" ]
  393. then
  394.     def=yes; x=1
  395. else
  396.     def=no; x=0
  397. fi
  398. if [ $alldefault = 0 ]
  399. then
  400.     $ECHO "Some SCO System V systems need sys/ptem.h included to get"
  401.     $ECHO "the size of the screen (struct winsize)."
  402.     $ECHO "Does your system need sys/ptem.h? [$def] \c"
  403.     read ans
  404.     case "X$ans" in
  405.     X[yY]*) x=1 ;;
  406.     X[nN]*) x=0 ;;
  407.     esac
  408.     $ECHO ""
  409. fi
  410. /bin/cat.ttp >>defines.h <<EOF
  411. /*
  412.  * NEED_PTEM_H is 1 if your system needs sys/ptem.h to declare struct winsize.
  413.  * This is normally the case only for SCOs System V.
  414.  */
  415. #define    NEED_PTEM_H    $x
  416.  
  417. EOF
  418.  
  419.  
  420. if [ "$sys" = "bsd" ]
  421. then
  422.     def=2; REGCMP=0;RECOMP=1
  423. else
  424.     def=1; REGCMP=1;RECOMP=0
  425. fi
  426. if [ $alldefault = 0 ]
  427. then
  428.     $ECHO "Most System V systems have the regcmp() function."
  429.     $ECHO "Most Berkeley-derived systems have the re_comp() function."
  430.     $ECHO "Does your system have:"
  431.     $ECHO "  1. regcmp"
  432.     $ECHO "  2. re_comp"
  433.     $ECHO "  3. neither   [$def] \c"
  434.     read ans
  435.     case "X$ans" in
  436.     X1) REGCMP=1;RECOMP=0 ;;
  437.     X2) REGCMP=0;RECOMP=1 ;;
  438.     X3) REGCMP=0;RECOMP=0 ;;
  439.     esac
  440.     $ECHO ""
  441. fi
  442. /bin/cat.ttp >>defines.h <<EOF
  443. /*
  444.  * REGCMP is 1 if your system has the regcmp() function.
  445.  * This is normally the case for System 5.
  446.  * RECOMP is 1 if your system has the re_comp() function.
  447.  * This is normally the case for BSD.
  448.  * If neither is 1, pattern matching is supported, but without metacharacters.
  449.  */
  450. #define    REGCMP        $REGCMP
  451. #define    RECOMP        $RECOMP
  452.  
  453. EOF
  454.  
  455.  
  456.  
  457.  
  458. def=yes
  459. x=1
  460. if [ $alloptional = 0 ]
  461. then
  462.     $ECHO "Do you wish to allow shell escapes? [$def] \c"
  463.     read ans
  464.     case "X$ans" in
  465.     X[yY]*) x=1 ;;
  466.     X[nN]*) x=0 ;;
  467.     esac
  468.     $ECHO ""
  469. fi
  470. /bin/cat.ttp >>defines.h <<EOF
  471. /*
  472.  * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  473.  * (This is possible only if your system supplies the system() function.)
  474.  */
  475. #define    SHELL_ESCAPE    $x
  476.  
  477. EOF
  478.  
  479.  
  480.  
  481. def=yes
  482. x=1
  483. edname="vi"
  484. if [ $alloptional = 0 ]
  485. then
  486.     $ECHO "Do you wish to allow editor escapes? [$def] \c"
  487.     read ans
  488.     case "X$ans" in
  489.     X[nN]*) x=0; edname="" ;;
  490.     X[yY]*) x=1
  491.         $ECHO "What is the pathname of the default editor? [$edname] \c"
  492.         read ans 
  493.         if [ "x$ans" != "x" ]
  494.         then
  495.             edname=$ans
  496.         fi
  497.         ;;
  498.     esac
  499.     $ECHO ""
  500. fi
  501. /bin/cat.ttp >>defines.h <<EOF
  502. /*
  503.  * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  504.  * (This is possible only if your system supplies the system() function.)
  505.  * EDIT_PGM is the name of the (default) editor to be invoked.
  506.  */
  507. #define    EDITOR        $x
  508. #define    EDIT_PGM    "$edname"
  509.  
  510. EOF
  511.  
  512.  
  513.  
  514.  
  515. def=yes
  516. x=1
  517. if [ $alloptional = 0 ]
  518. then
  519.     $ECHO "Do you wish to support \"tag\" files? [$def] \c"
  520.     read ans
  521.     case "X$ans" in
  522.     X[yY]*) x=1 ;;
  523.     X[nN]*) x=0 ;;
  524.     esac
  525.     $ECHO ""
  526. fi
  527. /bin/cat.ttp >>defines.h <<EOF
  528. /*
  529.  * TAGS is 1 if you wish to support tag files.
  530.  */
  531. #define    TAGS        $x
  532.  
  533. EOF
  534.  
  535.  
  536.  
  537. def=yes
  538. x=1
  539. if [ $alloptional = 0 ]
  540. then
  541.     $ECHO "Do you wish to allow user-defined key definitions? [$def] \c"
  542.     read ans
  543.     case "X$ans" in
  544.     X[yY]*) x=1 ;;
  545.     X[nN]*) x=0 ;;
  546.     esac
  547.     $ECHO ""
  548. fi
  549. USERFILE=$x
  550. /bin/cat.ttp >>defines.h <<EOF
  551. /*
  552.  * USERFILE is 1 if you wish to allow a .less file to specify 
  553.  * user-defined key bindings.
  554.  */
  555. #define    USERFILE    $x
  556.  
  557. EOF
  558.  
  559.  
  560.  
  561. def=yes
  562. x=1
  563. if [ $alldefault = 0 ]
  564. then
  565.     $ECHO "If your system provides the popen() function and"
  566.     $ECHO "the \"echo\" shell command, you may allow shell metacharacters" 
  567.     $ECHO "to be expanded in filenames."
  568.     $ECHO "Do you wish to allow shell metacharacters in filenames? [$def] \c"
  569.     read ans
  570.     case "X$ans" in
  571.     X[yY]*) x=1 ;;
  572.     X[nN]*) x=0 ;;
  573.     esac
  574.     $ECHO ""
  575. fi
  576. /bin/cat.ttp >>defines.h <<EOF
  577. /*
  578.  * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  579.  * This will generally work if your system provides the "popen" function
  580.  * and the "echo" shell command.
  581.  */
  582. #define    GLOB        $x
  583.  
  584. /*
  585.  * PIPEC is 1 if you wish to have the "|" command
  586.  * which allows the user to pipe data into a shell command.
  587.  */
  588. #define    PIPEC        $x
  589.  
  590. EOF
  591.  
  592.  
  593.  
  594. def=yes
  595. x=1
  596. if [ $alloptional = 0 ]
  597. then
  598.     $ECHO "Do you wish to allow log files (-l option)? [$def] \c"
  599.     read ans
  600.     case "X$ans" in
  601.     X[yY]*) x=1 ;;
  602.     X[nN]*) x=0 ;;
  603.     esac
  604.     $ECHO ""
  605. fi
  606. /bin/cat.ttp >>defines.h <<EOF
  607. /*
  608.  * LOGFILE is 1 if you wish to allow the -l option (to create log files).
  609.  */
  610. #define    LOGFILE        $x
  611.  
  612. EOF
  613.  
  614. /bin/cat.ttp >>defines.h <<EOF
  615. /*
  616.  * ONLY_RETURN is 1 if you want RETURN to be the only input which
  617.  * will continue past an error message.
  618.  * Otherwise, any key will continue past an error message.
  619.  */
  620. #define    ONLY_RETURN    0
  621.  
  622. EOF
  623.  
  624. /bin/cat.ttp >>makefile <<EOF
  625.  
  626. ##########################################################################
  627. # Compilation environment.
  628. ##########################################################################
  629.  
  630. EOF
  631.  
  632.  
  633.  
  634. if [ "$xenix" = "1" ]
  635. then
  636.     LIBS="-ltermlib"
  637. elif [ "$sys" = "bsd" ]
  638. then
  639.     LIBS="-ltermcap"
  640. else
  641.     LIBS="-lcurses -ltermcap -lPW"
  642. fi
  643. if [ $alldefault = 0 ]
  644. then
  645.     $ECHO "To build \"less\", you must link with libraries supplied by your system."
  646.     $ECHO "(If this needs to be changed later, edit the makefile"
  647.     $ECHO "and change the definition of LIBS.)"
  648.     $ECHO "What libraries should be used [$LIBS] \c"
  649.     read ans
  650.     if [ "X$ans" != "X" ]
  651.     then
  652.         LIBS="$ans"
  653.     fi
  654.     $ECHO ""
  655. fi
  656. /bin/cat.ttp >>makefile <<EOF
  657. # LIBS is the list of libraries needed.
  658. LIBS = $LIBS
  659.  
  660. EOF
  661.  
  662.  
  663.  
  664. INSTALL_LESS="/usr/local/bin/less"
  665. INSTALL_KEY="/usr/local/bin/lesskey"
  666. INSTALL_HELP="/usr/local/bin/less.hlp"
  667. INSTALL_LESSMAN="/usr/man/man1/less.1"
  668. INSTALL_KEYMAN="/usr/man/man1/lesskey.1"
  669. LESS_MANUAL="less.nro"
  670. KEY_MANUAL="lesskey.nro"
  671. if [ $alldefault = 0 ]
  672. then
  673.     $ECHO "What is the name of the \"public\" (installed) version of less?"
  674.     $ECHO " [$INSTALL_LESS] \c"
  675.     read ans
  676.     if [ "X$ans" != "X" ]
  677.     then
  678.         INSTALL_LESS="$ans"
  679.     fi
  680.     $ECHO "What is the name of the \"public\" (installed) version of lesskey?"
  681.     $ECHO " [$INSTALL_KEY] \c"
  682.     read ans
  683.     if [ "X$ans" != "X" ]
  684.     then
  685.         INSTALL_KEY="$ans"
  686.     fi
  687.     $ECHO "What is the name of the \"public\" (installed) version of the help file?"
  688.     $ECHO " [$INSTALL_HELP] \c"
  689.     read ans
  690.     if [ "X$ans" != "X" ]
  691.     then
  692.         INSTALL_HELP="$ans"
  693.     fi
  694.     $ECHO "What is the name of the \"public\" (installed) version of the less manual page?"
  695.     $ECHO " [$INSTALL_LESSMAN] \c"
  696.     read ans
  697.     if [ "X$ans" != "X" ]
  698.     then
  699.         INSTALL_LESSMAN="$ans"
  700.     fi
  701.     $ECHO "What is the name of the \"public\" (installed) version of the lesskey manual page?"
  702.     $ECHO " [$INSTALL_KEYMAN] \c"
  703.     read ans
  704.     if [ "X$ans" != "X" ]
  705.     then
  706.         INSTALL_KEYMAN="$ans"
  707.     fi
  708.     $ECHO ""
  709. fi
  710.  
  711. /bin/cat.ttp >>defines.h <<EOF
  712. /*
  713.  * HELPFILE is the full pathname of the help file.
  714.  */
  715. #define    HELPFILE    "$INSTALL_HELP"
  716.  
  717. EOF
  718.  
  719. /bin/cat.ttp >>makefile <<EOF
  720. # INSTALL_LESS is a list of the public versions of less.
  721. # INSTALL_KEY is a list of the public versions of lesskey.
  722. # INSTALL_HELP is a list of the public version of the help file.
  723. # INSTALL_LESSMAN is a list of the public versions of the less manual page.
  724. # INSTALL_KEYMAN is a list of the public versions of the lesskey manual page.
  725. INSTALL_LESS =        \$(ROOT)$INSTALL_LESS
  726. INSTALL_KEY =        \$(ROOT)$INSTALL_KEY
  727. INSTALL_HELP =        \$(ROOT)$INSTALL_HELP
  728. INSTALL_LESSMAN =    \$(ROOT)$INSTALL_LESSMAN
  729. INSTALL_KEYMAN =    \$(ROOT)$INSTALL_KEYMAN
  730. LESS_MANUAL =        $LESS_MANUAL
  731. KEY_MANUAL =        $KEY_MANUAL
  732. HELPFILE =        $INSTALL_HELP
  733.  
  734.  
  735. EOF
  736.  
  737.  
  738.  
  739. /bin/cat.ttp >>makefile <<"EOF"
  740. # OPTIM is passed to the compiler and the loader.
  741. # It is normally "-O" but may be, for example, "-g".
  742. OPTIM = -O
  743.  
  744. CFLAGS = $(OPTIM)
  745.  
  746.  
  747.  
  748. ##########################################################################
  749. # Files
  750. ##########################################################################
  751.  
  752. SRC1 =    ch.c cmdbuf.c command.c decode.c help.c input.c 
  753. SRC2 =    line.c linenum.c main.c edit.c option.c optfunc.c \
  754.     opttbl.c os.c 
  755. SRC3 =    charset.c filename.c lsystem.c output.c position.c ifile.c \
  756.     brac.c forwback.c jump.c search.c 
  757. SRC4 =    mark.c prompt.c screen.c signal.c tags.c ttyin.c version.c
  758.  
  759. SRC =    $(SRC1) $(SRC2) $(SRC3) $(SRC4)
  760.  
  761. OBJ =    brac.o ch.o charset.o cmdbuf.o command.o decode.o edit.o filename.o \
  762.     forwback.o help.o input.o jump.o line.o linenum.o \
  763.     lsystem.o main.o option.o optfunc.o opttbl.o os.o \
  764.     output.o position.o mark.o ifile.o prompt.o screen.o \
  765.     search.o signal.o tags.o ttyin.o version.o
  766.  
  767.  
  768. ##########################################################################
  769. # Rules for building stuff
  770. ##########################################################################
  771.  
  772. EOF
  773.  
  774. if [ "$USERFILE" = "1" ]
  775. then
  776.     /bin/cat.ttp >>makefile <<"EOF"
  777. all: less lesskey
  778. install: install_less install_help install_key install_lman install_kman
  779. EOF
  780. else
  781.     /bin/cat.ttp >>makefile <<"EOF"
  782. all: less
  783. install: install_less install_help install_lman
  784. EOF
  785. fi
  786.  
  787. /bin/cat.ttp >>makefile <<"EOF"
  788.  
  789. less: $(OBJ)
  790.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS) $(LDLIBS)
  791.  
  792. lesskey: lesskey.o
  793.     $(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS)
  794.  
  795. install_less: less
  796.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  797.     touch install_less
  798.  
  799. install_key: lesskey
  800.     for f in $(INSTALL_KEY); do  rm -f $$f; cp lesskey $$f;  done
  801.     touch install_key
  802.  
  803. install_help: less.hlp
  804.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.hlp $$f;  done
  805.     touch install_help
  806.  
  807. install_lman: $(LESS_MANUAL) 
  808.     for f in $(INSTALL_LESSMAN); do  rm -f $$f; cp $(LESS_MANUAL) $$f;  done
  809.     touch install_lman
  810.  
  811. install_kman: $(KEY_MANUAL)
  812.     for f in $(INSTALL_KEYMAN); do  rm -f $$f; cp $(KEY_MANUAL) $$f;  done
  813.     touch install_kman
  814.  
  815. ##########################################################################
  816. # Maintenance
  817. ##########################################################################
  818.  
  819. lint:
  820.     lint -hp $(SRC)
  821.  
  822. newfuncs funcs.h:
  823.     if [ -f funcs.h ]; then mv funcs.h funcs.h.OLD; fi
  824.     awk -f mkfuncs.awk $(SRC) >funcs.h
  825.  
  826. clean:
  827.     rm -f $(OBJ) lesskey.o less lesskey vecho.ttp
  828.  
  829. clobber:
  830.     rm -f *.o less lesskey vecho.ttp install_less install_key \
  831.         install_help install_lman install_kman
  832.  
  833. shar:
  834.     shar -v README CHANGES linstall \
  835.         less.nro lesskey.nro \
  836.         vecho.c mkfuncs.awk > less1.shr
  837.     shar -v less.man lesskey.man \
  838.         less.h position.h cmd.h option.h > less2.shr 
  839.     shar -v lesskey.c $(SRC1) > less3.shr
  840.     shar -v $(SRC2) > less4.shr
  841.     shar -v $(SRC3) less.hlp > less5.shr
  842.     shar -v $(SRC4) funcs.h > less6.shr
  843.  
  844.  
  845. ##########################################################################
  846. # Dependencies
  847. ##########################################################################
  848.  
  849. $(OBJ): less.h funcs.h defines.h position.h
  850. command.o decode.o: cmd.h
  851. option.o opttbl.o optfunc.o: option.h
  852.  
  853. lesskey.o: less.h funcs.h defines.h cmd.h
  854.  
  855. EOF
  856. $ECHO ""
  857.  
  858. $ECHO "The makefile and defines.h have been built."
  859. $ECHO "You should check them to make sure everything is as you want it to be."
  860. $ECHO "When you are satisfied, just type \"make\", and \"less\" will be built."
  861.